#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int F(int s)
{
	int a=s/1000;
	int b=s%1000/100;
	int c=s%1000%100/10;
	int d=s%1000%100%10;
	return d*1000+c*100+b*10+a;
}
int main()
{
	int s=0;
	scanf("%d",&s);
	s=F(s);
	printf("%d\n",s);
	return 0;
}